<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title><?php echo ($meta_title); ?>|ItemBank 通用题库管理平台</title>
    <link href="/itembank/Public/favicon.ico" type="image/x-icon" rel="shortcut icon">
    <link rel="stylesheet" type="text/css" href="/itembank/Public/Admin/css/base.css" media="all">
    <link rel="stylesheet" type="text/css" href="/itembank/Public/Admin/css/common.css" media="all">
    <link rel="stylesheet" type="text/css" href="/itembank/Public/Admin/css/module.css" media="all">
    <link rel="stylesheet" type="text/css" href="/itembank/Public/Admin/css/style.css" media="all">
	<link rel="stylesheet" type="text/css" href="/itembank/Public/Admin/css/<?php echo (C("COLOR_STYLE")); ?>.css" media="all">
     <!--[if lt IE 9]>
    <script type="text/javascript" src="/itembank/Public/static/jquery-1.10.2.min.js"></script>
    <![endif]--><!--[if gte IE 9]><!-->
    <script type="text/javascript" src="/itembank/Public/static/jquery-2.0.3.min.js"></script>
    <script type="text/javascript" src="/itembank/Public/Admin/js/jquery.mousewheel.js"></script>
    <!--<![endif]-->
     <script
	src="/itembank/Public/static/thinkbox/jquery.thinkbox.js"></script> <script
	type="text/javascript" src="/itembank/Public/static/qtip/jquery.qtip.min.js"></script>
<link rel="stylesheet" type="text/css"
	href="/itembank/Public/static/qtip/jquery.qtip.min.css" media="all">

</head>
<body oncontextmenu="return false">
    <!-- 头部 -->
    <div class="header">
        <!-- Logo -->
        <span class="logo"></span>
        <!-- /Logo -->

        <!-- 主导航 -->
        <ul class="main-nav">
            <?php if(is_array($__MENU__["main"])): $i = 0; $__LIST__ = $__MENU__["main"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$menu): $mod = ($i % 2 );++$i;?><li class="<?php echo ((isset($menu["class"]) && ($menu["class"] !== ""))?($menu["class"]):''); ?>"><a href="<?php echo (u($menu["url"])); ?>"><?php echo ($menu["title"]); ?></a></li><?php endforeach; endif; else: echo "" ;endif; ?>
        </ul>
        <!-- /主导航 -->

        <!-- 用户栏 -->
        <div class="user-bar">
            <a href="javascript:;" class="user-entrance"><i class="icon-user"></i></a>
            <ul class="nav-list user-menu hidden">
                <li class="manager">欢迎：<em title="<?php echo session('user_auth.username');?>"><?php echo session('user_auth.username');?></em></li>
                <li><a href="<?php echo U('User/updatePassword');?>">修改密码</a></li>
                <li><a href="<?php echo U('User/updateNickname');?>">修改昵称</a></li>
                <li><a href="<?php echo U('Public/logout');?>">退出</a></li>
            </ul>
        </div>
    </div>
    <!-- /头部 -->

    <!-- 边栏 -->
    <div class="sidebar">
        <!-- 子导航 -->
        
            <div id="subnav" class="subnav">
                <?php if(!empty($_extra_menu)): ?>
                    <?php echo extra_menu($_extra_menu,$__MENU__); endif; ?>
                <?php if(is_array($__MENU__["child"])): $i = 0; $__LIST__ = $__MENU__["child"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$sub_menu): $mod = ($i % 2 );++$i;?><!-- 子导航 -->
                    <?php if(!empty($sub_menu)): if(!empty($key)): ?><h3><i class="icon icon-unfold"></i><?php echo ($key); ?></h3><?php endif; ?>
                        <ul class="side-sub-menu">
                            <?php if(is_array($sub_menu)): $i = 0; $__LIST__ = $sub_menu;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$menu): $mod = ($i % 2 );++$i;?><li>
                                    <a class="item" href="<?php echo (u($menu["url"])); ?>"><?php echo ($menu["title"]); ?></a>
                                </li><?php endforeach; endif; else: echo "" ;endif; ?>
                        </ul><?php endif; ?>
                    <!-- /子导航 --><?php endforeach; endif; else: echo "" ;endif; ?>
            </div>
        
        <!-- /子导航 -->
    </div>
    <!-- /边栏 -->

    <!-- 内容区 -->
    <div id="main-content">
        <div id="top-alert" class="fixed alert alert-error" style="display: none;">
            <button class="close fixed" style="margin-top: 4px;">&times;</button>
            <div class="alert-content">这是内容</div>
        </div>
        <div id="main" class="main">
            
            <!-- nav -->
            <?php if(!empty($_show_nav)): ?><div class="breadcrumb">
                <span>您的位置:</span>
                <?php $i = '1'; ?>
                <?php if(is_array($_nav)): foreach($_nav as $k=>$v): if($i == count($_nav)): ?><span><?php echo ($v); ?></span>
                    <?php else: ?>
                    <span><a href="<?php echo ($k); ?>"><?php echo ($v); ?></a>&gt;</span><?php endif; ?>
                    <?php $i = $i+1; endforeach; endif; ?>
            </div><?php endif; ?>
            <!-- nav -->
            

             <!-- 标题栏 -->
<div class="main-title">
	<h2>组建试卷 [ <?php echo ($ib_info['name']); ?> ]</h2>
</div>
<form action="<?php echo U();?>" method="post" class="form-horizontal">
	<div class="form-item">
		<label class="item-label">名称<span class="check-tips">（试卷名称，自动填充日期时间）</span></label>
		<div class="controls">
			<input type="text" class="text input-large" name="name"
				value="<?php echo ($papername); ?>"
				onkeyup="value=value.replace(/(^\s*)|(\s*$)/g,'')">
		</div>
	</div>
	<div class="form-item">
		<label class="item-label">主标题<span class="check-tips">（试卷主标题，包含适用学期、试卷类别、试卷名称等）</span></label>
		<div class="controls">
			<input type="text" class="text input-large" name="mastertitle"
				value="<?php echo ($mastertitle); ?>"
				onkeyup="value=value.replace(/(^\s*)|(\s*$)/g,'')">
		</div>
	</div>
	<div class="form-item">
		<label class="item-label">副标题<span class="check-tips">（试卷副标题，包含适用专业等）</span></label>
		<div class="controls">
			<input type="text" class="text input-large" name="secondtitle"
				value="<?php echo ($secondtitle); ?>"
				onkeyup="value=value.replace(/(^\s*)|(\s*$)/g,'')">
		</div>
	</div>

	<div class="form-item">
		<label class="item-label">总分、套数<span class="check-tips">（试卷总分、套数）</span></label>
		<div class="controls">
			<input type="text" class="text input-small" name="score" title="试卷总分"
				value="100" onkeyup="value=value.replace(/[^\d]/g,'')"
				onpaste="return false"> <input type="text"
				class="text input-small" name="sets" title="试卷套数" value="2"
				onkeyup="value=value.replace(/[^\d]/g,'')" onpaste="return false">
		</div>
	</div>
	<div class="form-item">
		<label class="item-label">题型及其章节设置<span class="check-tips">（题型选择、排序、设置类型出题数量及其章节出题数量）</span></label>
		<div class="controls">
			<input type="hidden" name="types" value="<?php echo ($types); ?>"
				readonly="readonly"> <input type="hidden"
				name="max_types_count" value="<?php echo ($types_count); ?>" readonly="readonly">
			<input type="hidden" name="types_count" value="<?php echo ($types_count); ?>"
				readonly="readonly"> <input type="hidden" name="types_score"
				value="<?php echo ($types_score); ?>" readonly="readonly"> <input
				type="hidden" name="types_info" value="<?php echo ($types_info); ?>"
				readonly="readonly"><input type="hidden"
				name="chapters_type" value="<?php echo ($chapters_type); ?>" readonly="readonly">
			<input type="hidden" name="chapters_chapter"
				value="<?php echo ($chapters_chapter); ?>" readonly="readonly"> <input
				type="hidden" name="max_chapters_count"
				value="<?php echo ($max_chapters_count); ?>" readonly="readonly"> <input
				type="hidden" name="chapters_count" value="<?php echo ($chapters_count); ?>"
				readonly="readonly">
			<ul id="sortUl" class="dragsort">
				<?php if(is_array($question_types_counts)): $i = 0; $__LIST__ = $question_types_counts;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><li class="getSort" style="width: 80%; height: auto;" title="拖动排序">
					<div style="margin-left: 10px;margin-right: 10px;">
						<b class="del" title="点击删除">&times;</b> <label class="item-label"
							title="拖动排序"><?php echo (get_questiontype_name($vo["questiontype"])); ?> [
							<?php echo ($vo["typecount"]); ?> ]<span class="check-tips">（设置类型题数量、总分、分值分布详情）</span>
						</label> <input type="hidden" name="typeid" value="<?php echo ($vo['questiontype']); ?>">
						<input type="hidden" name="typecount" value="<?php echo ($vo['typecount']); ?>">
						<span class="divsion">&nbsp;&nbsp;&nbsp;&nbsp;数量：</span><input
							type="text" class="text input-small" title="类型题数量"
							name="setcount" value="<?php echo ($vo['typecount']); ?>"
							onkeyup="value=value.replace(/[^\d]/g,'')" onpaste="return false">
						<span class="divsion">&nbsp;&nbsp;&nbsp;&nbsp;总分：</span><input
							type="text" class="text input-small" title="类型题总分"
							name="setscore" value="10"
							onkeyup="value=value.replace(/[^\d]/g,'')" onpaste="return false">
						<span class="divsion">&nbsp;&nbsp;&nbsp;&nbsp;详情：</span><input
							type="text" class="text input-large" title="分值分布详情"
							name="setinfo" value="每小题1分"
							onkeyup="value=value.replace(/(^\s*)|(\s*$)/g,'')"> <label
							class="item-label" title="拖动排序">章节设置<span
							class="check-tips">（设定本题型所含章节出题数量，留空表示随机选择，零表示不选择）</span>
						</label>
						<?php $_result=explode('#',$vo['typechaptercounts']);if(is_array($_result)): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$typechaptercounts_vo): $mod = ($i % 2 );++$i;?><div style="float: left;margin-bottom: 5px;">
							<?php $_result=explode(':',$typechaptercounts_vo);if(is_array($_result)): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$tcc_vo): $mod = ($i % 2 );++$i; if($key == 0): ?><input type="hidden"
								name="setchaptertype" value="<?php echo ($tcc_vo); ?>"> <?php else: ?> <?php if($key == 1): ?><input type="hidden"
								name="setchapterchapter" value="<?php echo ($tcc_vo); ?>"> <span
								class="divsion">&nbsp;&nbsp;&nbsp;&nbsp;<?php echo (get_chapter_name($tcc_vo)); ?></span> <?php else: ?> <span class="divsion">&nbsp;[ <?php echo ($tcc_vo); ?> ]：</span>
							<input
								type="hidden" name="setmaxchaptercount" value="<?php echo ($tcc_vo); ?>">
							<input type="text" class="text input-small" style="width: 60px;"
								title="出题数量，留空表示随机选择，零表示不选择" name="setchaptercount" value=""
								onkeyup="value=value.replace(/[^\d]/g,'')"
								onpaste="return false"><?php endif; endif; endforeach; endif; else: echo "" ;endif; ?>
						</div><?php endforeach; endif; else: echo "" ;endif; ?>
					</div>
				</li><?php endforeach; endif; else: echo "" ;endif; ?>
			</ul>
		</div>
	</div>
	<div class="form-item">
		<input type="hidden" name="itembank" value="<?php echo ($ib_info['id']); ?>" />
		<button class="btn submit-btn ajax-post" id="submit" type="submit"
			target-form="form-horizontal">确 定</button>
		<button class="btn btn-return"
			onclick="javascript:history.back(-1);return false;">返 回</button>
	</div>

</form>

        </div>
        <div class="cont-ft">
            <div class="copyright">
                <div class="fl">感谢使用<a href="#">ItemBank</a>管理平台</div>
                <div class="fr">Version <?php echo (ONETHINK_VERSION); ?></div>
            </div>
        </div>
    </div>
    <!-- /内容区 -->
    <script type="text/javascript">
    (function(){
        var ThinkPHP = window.Think = {
            "ROOT"   : "/itembank", //当前网站地址
            "APP"    : "/itembank/index.php?s=", //当前项目地址
            "PUBLIC" : "/itembank/Public", //项目公共目录地址
            "DEEP"   : "<?php echo C('URL_PATHINFO_DEPR');?>", //PATHINFO分割符
            "MODEL"  : ["<?php echo C('URL_MODEL');?>", "<?php echo C('URL_CASE_INSENSITIVE');?>", "<?php echo C('URL_HTML_SUFFIX');?>"],
            "VAR"    : ["<?php echo C('VAR_MODULE');?>", "<?php echo C('VAR_CONTROLLER');?>", "<?php echo C('VAR_ACTION');?>"]
        }
    })();
    </script>
    <script type="text/javascript" src="/itembank/Public/static/think.js"></script>
    <script type="text/javascript" src="/itembank/Public/Admin/js/common.js"></script>
    <script type="text/javascript">
        +function(){
            var $window = $(window), $subnav = $("#subnav"), url;
            $window.resize(function(){
                $("#main").css("min-height", $window.height() - 130);
            }).resize();

            /* 左边菜单高亮 */
            url = window.location.pathname + window.location.search;
            url = url.replace(/(\/(p)\/\d+)|(&p=\d+)|(\/(id)\/\d+)|(&id=\d+)|(\/(group)\/\d+)|(&group=\d+)/, "");
            $subnav.find("a[href='" + url + "']").parent().addClass("current");

            /* 左边菜单显示收起 */
            $("#subnav").on("click", "h3", function(){
                var $this = $(this);
                $this.find(".icon").toggleClass("icon-fold");
                $this.next().slideToggle("fast").siblings(".side-sub-menu:visible").
                      prev("h3").find("i").addClass("icon-fold").end().end().hide();
            });

            $("#subnav h3 a").click(function(e){e.stopPropagation()});

            /* 头部管理员菜单 */
            $(".user-bar").mouseenter(function(){
                var userMenu = $(this).children(".user-menu ");
                userMenu.removeClass("hidden");
                clearTimeout(userMenu.data("timeout"));
            }).mouseleave(function(){
                var userMenu = $(this).children(".user-menu");
                userMenu.data("timeout") && clearTimeout(userMenu.data("timeout"));
                userMenu.data("timeout", setTimeout(function(){userMenu.addClass("hidden")}, 100));
            });

	        /* 表单获取焦点变色 */
	        $("form").on("focus", "input", function(){
		        $(this).addClass('focus');
	        }).on("blur","input",function(){
				        $(this).removeClass('focus');
			        });
		    $("form").on("focus", "textarea", function(){
			    $(this).closest('label').addClass('focus');
		    }).on("blur","textarea",function(){
			    $(this).closest('label').removeClass('focus');
		    });

            // 导航栏超出窗口高度后的模拟滚动条
            var sHeight = $(".sidebar").height();
            var subHeight  = $(".subnav").height();
            var diff = subHeight - sHeight; //250
            var sub = $(".subnav");
            if(diff > 0){
                $(window).mousewheel(function(event, delta){
                    if(delta>0){
                        if(parseInt(sub.css('marginTop'))>-10){
                            sub.css('marginTop','0px');
                        }else{
                            sub.css('marginTop','+='+10);
                        }
                    }else{
                        if(parseInt(sub.css('marginTop'))<'-'+(diff-10)){
                            sub.css('marginTop','-'+(diff-10));
                        }else{
                            sub.css('marginTop','-='+10);
                        }
                    }
                });
            }
        }();
    </script>
     <script type="text/javascript"
	src="/itembank/Public/static/jquery.dragsort.js"></script> <script
	type="text/javascript">
	$(function(){
		$("#sortUl").dragsort({
            dragSelector:'li',
            placeHolderTemplate: '<li class="draging-place">&nbsp;</li>',
            dragEnd:function(){
            	updateVal();
            }
        });

		$('#sortUl li div b').click(function(){
        	$(this).parent().parent().remove();
        	updateVal();
        });
		
		$('#sortUl li > div input').change(function(){
        	updateVal();
        });
		
		$('#sortUl li div > div input').change(function(){
        	updateVal();
        });

		// 更新隐藏域的值
        function updateVal() {
        	var typesVal = [];
        	var maxcountVal = [];
        	var countVal = [];
        	var scoreVal = [];
        	var infoVal = [];
        	var chaptertypesVal = [];
        	var chapterchaptersVal = [];
        	var chaptermaxcountsVal = [];
        	var chaptercountsVal = [];
     	
        	$('#sortUl li > div').each(function(){
        		typesVal.push($("input[name='typeid']",this).val());
        		maxcountVal.push($("input[name='typecount']",this).val());
        		countVal.push($("input[name='setcount']",this).val());
        		scoreVal.push($("input[name='setscore']",this).val());
        		infoVal.push($("input[name='setinfo']",this).val());
          	});
        	$('#sortUl li div > div').each(function(){
        	chaptertypesVal.push($("input[name='setchaptertype']",this).val());
    		chapterchaptersVal.push($("input[name='setchapterchapter']",this).val());
    		chaptermaxcountsVal.push($("input[name='setmaxchaptercount']",this).val());
    		chaptercountsVal.push($("input[name='setchaptercount']",this).val());
        	});
        	$("input[name='types']").val(typesVal.join(','));
        	$("input[name='max_types_count']").val(maxcountVal.join(','));
            $("input[name='types_count']").val(countVal.join(','));
            $("input[name='types_score']").val(scoreVal.join(','));
            $("input[name='types_info']").val(infoVal.join('`'));
            $("input[name='chapters_type']").val(chaptertypesVal.join(','));
            $("input[name='chapters_chapter']").val(chapterchaptersVal.join(','));
            $("input[name='max_chapters_count']").val(chaptermaxcountsVal.join(','));
            $("input[name='chapters_count']").val(chaptercountsVal.join(','));
        }
	})
</script> <script type="text/javascript">

	+function($){
		$('.text').each(function(){
	        $(this).qtip({
	            content: {
	                text: $(this).attr('title'),
	                title: ' ',
	            },
	            position: {
	                my: 'top center',
	                at: 'bottom center',
	                target: $(this)
	            },
	            style: {
	                classes: 'qtip-green',
	                tip: {
	                    corner: true,
	                    mimic: false,
	                    width: 5,
	                    height: 5
	                }
	            }
	        });
	    });
		
		$('.del').each(function(){
	        $(this).qtip({
	            content: {
	                text: $(this).attr('title'),
	                title: ' ',
	            },
	            position: {
	                my: 'top center',
	                at: 'bottom center',
	                target: $(this)
	            },
	            style: {
	                classes: 'qtip-green',
	                tip: {
	                    corner: true,
	                    mimic: false,
	                    width: 5,
	                    height: 5
	                }
	            }
	        });
	    });
		
	    //导航高亮
	    $('.side-sub-menu').find('a[href="<?php echo U('index');?>"]').closest('li').addClass('current');
	}(jQuery);
	</script> 
</body>
</html>